<?php
/**
 * 返回错误的类
 *
 * @author ananda
 */
class Error
{
    protected $message;
    protected $code;
    protected $previous;

    public function  __construct($message, $code = 0, Error $previous = null) {
        $this->message  = $message;
        $this->code     = $code;
        $this->previous = $previous;
    }

    public static function is($var)
    {
        if ($var instanceof self) {
            return true;
        }
        return false;
    }

    public function __toString()
    {
        echo $this->message;
    }

    public function getMessage()
    {
        return $this->message;
    }

    public function getCode()
    {
        return $this->code;
    }

    public function getPrevious()
    {
        return $this->previous;
    }
}
?>
